package Choose_to_do;

public class PageDemo {
    public static void main(String[] args){
        int PageCount = 55;
        int PageSize = 10;
        int currentPage=2;
        int currentPage_1=2;
//总页数: 如果总条数和页面显示的条数相除, 能除尽则取商, 否则取商加1作为总页数page
        int page = PageCount%PageSize == 0 ?
                PageCount/PageSize : PageCount/PageSize +1;
       //（1）一共有55条数据,每页显示10条数据,当前页为2，请求出上一页
        int last_page = currentPage == 2 ? 1:currentPage -1;
        System.out.println(last_page);

        //（2）一共有55条数据,每页显示10条数据,当前页为2，请求出下一页
        int next_page = currentPage_1 == 2 ? currentPage_1 + 1:page;
        System.out.println(next_page);
    }
}

